package com.miaoji.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.miaoji.domain.po.OrderDetail;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface OrderDetailMapper extends BaseMapper<OrderDetail> {
    @Select("select * from order_detail where order_id=#{order_id}")
    public List<OrderDetail> orderDetailSelect(int order_id);

    @Select("<script>" +
            "SELECT * FROM order_detail WHERE order_id IN " +
            "<foreach item='item' collection='orderIds' open='(' separator=',' close=')'>" +
            "#{item}" +
            "</foreach>" +
            "</script>")
    List<OrderDetail> selectByOrderIds(@Param("orderIds") List<Integer> orderIds);
    @Update("update order_detail set order_detail_state=-1 where id=#{id}")
    int deleteOrderDetail(int id);
    @Update("update order_detail set order_detail_state=0 where id=#{id}")
    int detailRollback(int id);

}

